package com.atserver.service;

import com.atserver.vedio.UsbCameraControl;

import javax.swing.*;

/**
 * @program: atserver
 * @description: 关闭usb摄像头
 * @author: Mr.Chen
 * @create: 2023-05-03 18:39
 **/
public class CameraEndTask extends SwingWorker<String, Object> {

    private UsbCameraControl usbCamera;

    public CameraEndTask(UsbCameraControl usbCamera) {
        this.usbCamera = usbCamera;
    }

    /**
     * Computes a result, or throws an exception if unable to do so.
     *
     * <p>
     * Note that this method is executed only once.
     *
     * <p>
     * Note: this method is executed in a background thread.
     *
     * @return the computed result
     * @throws Exception if unable to compute a result
     */
    @Override
    protected String doInBackground() throws Exception {
        usbCamera.endCamera();
        return "camera end";
    }
}
